package study.chapter03.thread;

public class TestThread1 {
    public static void main(String[] args) {
        new MyThread("A").start();
        new MyThread("B").start();
        new MyThread("C").start();
    }
}


//1. 通过继承Thread类实现多线程
class MyThread extends Thread{
    private String threadName;

    MyThread(String threadName){
        this.threadName = threadName;
    }

    @Override
    public void run() {
        for (int i = 1; i <= 5; i++) {
            System.out.println("线程：" + threadName + ", i = " + i);
        }
    }
}


//2. 通过实现Runnable实现多线程
